//
//  KMineRequest.m
//  QiJi
//
//  Created by Jim huang on 2018/6/11.
//  Copyright © 2018年 Jim_QiJi. All rights reserved.
//

#import "KMineRequest.h"
#import "KMineAPI.h"

@implementation KMineRequest



/**
 我的团队

 @param type 类型 type=1 服务站，type=2 琪迹卡

 */
-(instancetype)initMyTeamWithType:(NSString *)type{
    
    
    if (self = [super initGETWithRequestUrl:KGetMyTeamURL]) {
        [self.paramsDic setValue:type forKey:@"type"];

    }
    return self;

}

/**
 收藏列表
 
 @param page 当前页
 @param type 类型 0=全部，1=经验分享，2=行业资讯，3=视频教程
 
 */
-(instancetype)initMyCollectionListWithPage:(NSString *)page type:(NSString *)type{
    if (self = [super initGETWithRequestUrl:KGetMyCollectionURL]) {
        [self.paramsDic setValue:type forKey:@"type"];
        [self.paramsDic setValue:page forKey:@"page"];

    }
    return self;

}

#pragma mark ----地址管理
/**
 收货地址列表
 
 */
-(instancetype)initMyAddressList{
    
    if (self = [super initGETWithRequestUrl:KAddressListURL]) {
        
    }
    return self;
    
}



/**
 新增收货地址
 
 @param adressResultModel 地址model
 @param detail 详情
 @param isDefault 是否为默认     N=不是，Y=是
 @param name 收件人
 @param phone 联系电话
 */
-(instancetype)initAddAddressWithAdressResultModel:(AddressProvinceCityResultModel *)adressResultModel detail:(NSString *)detail isDefault:(NSString *)isDefault name:(NSString *)name phone:(NSString *)phone{
    
    
    if (self = [super initPOSTWithRequestUrl:KAddAddressURL]) {
        [self.paramsDic setValue:adressResultModel.provinceId forKey:@"prId"];
        [self.paramsDic setValue:adressResultModel.province forKey:@"prName"];
        [self.paramsDic setValue:adressResultModel.cityId forKey:@"ciId"];
        [self.paramsDic setValue:adressResultModel.city forKey:@"ciName"];
        [self.paramsDic setValue:adressResultModel.areaId forKey:@"arId"];
        [self.paramsDic setValue:adressResultModel.area forKey:@"arName"];
        
        [self.paramsDic setValue:detail forKey:@"detail"];
        [self.paramsDic setValue:isDefault forKey:@"isDefault"];
        [self.paramsDic setValue:name forKey:@"name"];
        [self.paramsDic setValue:phone forKey:@"phone"];

    }
    return self;
    
}


/**
 删除收地址
 @param key id
 
 */
-(instancetype)initDeleteAddressWithKey:(NSString *)key{
    
    if (self = [super initGETWithRequestUrl:KdeleteAddressURL]) {
        [self.paramsDic setValue:key forKey:@"key"];

    }
    return self;
    
}



/**
 修改收货地址
 
 @param adressResultModel 地址model
 @param detail 详情
 @param isDefault 是否为默认     N=不是，Y=是
 @param name 收件人
 @param phone 联系电话
 @param id id
 
 */
-(instancetype)initChangeAddressWithAdressResultModel:(AddressProvinceCityResultModel *)adressResultModel detail:(NSString *)detail isDefault:(NSString *)isDefault name:(NSString *)name phone:(NSString *)phone id:(NSString *)id{
    
    
    if (self = [super initPOSTWithRequestUrl:KChangeAddressURL]) {
        [self.paramsDic setValue:adressResultModel.provinceId forKey:@"prId"];
        [self.paramsDic setValue:adressResultModel.province forKey:@"prName"];
        [self.paramsDic setValue:adressResultModel.cityId forKey:@"ciId"];
        [self.paramsDic setValue:adressResultModel.city forKey:@"ciName"];
        [self.paramsDic setValue:adressResultModel.areaId forKey:@"arId"];
        [self.paramsDic setValue:adressResultModel.area forKey:@"arName"];
        
        [self.paramsDic setValue:detail forKey:@"detail"];
        [self.paramsDic setValue:isDefault forKey:@"isDefault"];
        [self.paramsDic setValue:name forKey:@"name"];
        [self.paramsDic setValue:phone forKey:@"phone"];
        [self.paramsDic setValue:id forKey:@"id"];

    }
    return self;
}

/**
 设为默认地址
 
 @param key id
 */
-(instancetype)initSetDefaultAddressWithKey:(NSString *)key{
    
    if (self = [super initGETWithRequestUrl:KSetDefaultAddressURL]) {
        [self.paramsDic setValue:key forKey:@"key"];
        
    }
    return self;
    
}


#pragma mark ----身份认证

/**
 实名认证
 
 @param trueName 真实姓名
 @param type 类型
 @param frontImageUrl 正面照
 @param backImageUrl 反面照
 */
-(instancetype)initUploadTurenameWithTrueName:(NSString *)trueName type:(NSString *)type frontImageUrl:(NSString *)frontImageUrl backImageUrl:(NSString *)backImageUrl{
    
    if (self = [super initPOSTWithRequestUrl:KUploadTurenameURL]) {
        [self.paramsDic setValue:trueName forKey:@"trueName"];
        [self.paramsDic setValue:type forKey:@"type"];
        [self.paramsDic setValue:frontImageUrl forKey:@"frontImageUrl"];
        [self.paramsDic setValue:backImageUrl forKey:@"backImageUrl"];
        
    }
    return self;
    
}

/**
 获取认证信息
 */
-(instancetype)initCheckTurename{
    
    if (self = [super initGETWithRequestUrl:KCheckTurenameURL]) {
    }
    return self;
    
}

@end
